package com.pzsh.sms.sanwang.api;
/**
短信通知
 商品购买地址：https://market.aliyun.com/products/57126001/cmapi025334.html
 String host = "http://smsmsgs.market.alicloudapi.com"; //服务器
 String path = "/smsmsgs"; //接口地址
 */


import com.pzsh.sms.sanwang.util.HttpUtils;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;

import java.util.HashMap;
import java.util.Map;

public class FegineApi {

    public static void sanwang(String code,String mobile) {
//        String APP_KEY = "LTAI4Fxde8ESKT3i6Bxnvw3i";
//        String APP_SECRET = "zcs7akA8hhVzXq1WA2HRRYVohgTmI7";
//        String SIGN_NAME = "品质生活";
        String TEMPLATE_CODE = "SMS_180053622";
//        String REGION_ID = "cn-hangzhou";

        String host = "http://smsmsgs.market.alicloudapi.com";
        String path = "/smsmsgs";
        String method = "GET";
        System.out.println("请先替换成自己的AppCode");
        String appcode = "9ec46a813f4843f9a984f1c1c7159159";  // !!! 替换这里填写你自己的AppCode 请在买家中心查看
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("Authorization", "APPCODE " + appcode); //格式为:Authorization:APPCODE 83359fd73fe11248385f570e3c139xxx
        Map<String, String> querys = new HashMap<String, String>();
        querys.put("param", code);// !!! 请求参数
        querys.put("phone", mobile);// !!! 请求参数
//        querys.put("sign", "品质生活");
        querys.put("skin", "16");// !!! 请求参数
        try {
            HttpResponse response = com.pzsh.sms.sanwang.util.HttpUtils.doGet(host, path, method, headers, querys);
            //System.out.println(response.toString()); //输出头部
            System.out.println(EntityUtils.toString(response.getEntity())); //输出json
        } catch (Exception e) {
        }
    }
}
